using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using AuthService.Domain.OAuth;

namespace AuthService.OAuth;

/// <summary>
/// OAuth客户端仓储接口
/// </summary>
public interface IOAuthClientRepository : IRepository<OAuthClient, Guid>
{
    /// <summary>
    /// 根据客户端ID获取客户端
    /// </summary>
    Task<OAuthClient> GetByClientIdAsync(string clientId, CancellationToken cancellationToken = default);

    /// <summary>
    /// 根据客户端ID获取客户端，包含详细信息
    /// </summary>
    Task<OAuthClient> GetByClientIdAsync(string clientId, bool includeDetails = false, CancellationToken cancellationToken = default);

    /// <summary>
    /// 获取租户的所有活跃客户端
    /// </summary>
    Task<List<OAuthClient>> GetActiveClientsAsync(Guid? tenantId, CancellationToken cancellationToken = default);

    /// <summary>
    /// 根据客户端名称查找客户端
    /// </summary>
    Task<List<OAuthClient>> GetByNameAsync(string clientName, CancellationToken cancellationToken = default);

    /// <summary>
    /// 检查客户端ID是否存在
    /// </summary>
    Task<bool> ExistsByClientIdAsync(string clientId, CancellationToken cancellationToken = default);

    /// <summary>
    /// 获取客户端列表（分页）
    /// </summary>
    Task<List<OAuthClient>> GetListAsync(string filter = null, int maxResultCount = 10, int skipCount = 0, CancellationToken cancellationToken = default);

    /// <summary>
    /// 获取客户端总数
    /// </summary>
    Task<long> GetCountAsync(string filter = null, CancellationToken cancellationToken = default);
}